package com.zuxia.action;

import java.io.IOException;
import java.util.List;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.zuxia.iservices.CardtypeinfoServicesI;
import com.zuxia.po.Cardtypeinfo;
import com.zuxia.po.Partstypeinfo;

public class CardtypeinfoAction extends BaseAction{
	private CardtypeinfoServicesI cardtypeinfoServices;
	
	public CardtypeinfoServicesI getCardtypeinfoServices() {
		return cardtypeinfoServices;
	}

	public void setCardtypeinfoServices(CardtypeinfoServicesI cardtypeinfoServices) {
		this.cardtypeinfoServices = cardtypeinfoServices;
	}

	//查询汽车类型信息
	public void findAll(){
		System.out.println("查询所有汽车类型");
		List<Cardtypeinfo> list=cardtypeinfoServices.findAll();
		if (list!=null) {
			SimplePropertyPreFilter filter = new SimplePropertyPreFilter(Cardtypeinfo.class, "ctiid","ctitype");
			String json = JSON.toJSONString(list,filter,SerializerFeature.DisableCircularReferenceDetect);
			System.out.println(list);
			try {
				getResponse().getWriter().print(json);
				System.err.println("查询到的汽车类型json字符串如下！"+json);
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}
